﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace S.PurchaseAndSales.Comain.Migrations
{
    public partial class updatePurchaseAndSalesModel : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "PersonalSaleModels");

            migrationBuilder.DropColumn(
                name: "ElectronicEarTags",
                table: "SheepSaleModels");

            migrationBuilder.DropColumn(
                name: "SheepRescissionId",
                table: "PurchaseFormModels");

            migrationBuilder.RenameColumn(
                name: "UpdateTime",
                table: "SheepSaleModels",
                newName: "UpdateDate");

            migrationBuilder.RenameColumn(
                name: "SheepSex",
                table: "SheepSaleModels",
                newName: "Sex");

            migrationBuilder.RenameColumn(
                name: "MotherSign",
                table: "SheepSaleModels",
                newName: "ParentEITag");

            migrationBuilder.RenameColumn(
                name: "FatherSign",
                table: "SheepSaleModels",
                newName: "MotherEITag");

            migrationBuilder.RenameColumn(
                name: "CurrentField",
                table: "SheepSaleModels",
                newName: "ColumnName");

            migrationBuilder.RenameColumn(
                name: "CurrentBuilding",
                table: "SheepSaleModels",
                newName: "BuildingName");

            migrationBuilder.RenameColumn(
                name: "CreateTime",
                table: "SheepSaleModels",
                newName: "CreateDate");

            migrationBuilder.RenameColumn(
                name: "ColumnManagementId",
                table: "PurchaseFormModels",
                newName: "ColumnName");

            migrationBuilder.RenameColumn(
                name: "UpdateTime",
                table: "CustomerInformation",
                newName: "UpdateDate");

            migrationBuilder.RenameColumn(
                name: "CreateTime",
                table: "CustomerInformation",
                newName: "CreateDate");

            migrationBuilder.AddColumn<string>(
                name: "EITag",
                table: "SheepSaleModels",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "BuildingName",
                table: "PurchaseFormModels",
                type: "nvarchar(max)",
                nullable: false,
                defaultValue: "");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "EITag",
                table: "SheepSaleModels");

            migrationBuilder.DropColumn(
                name: "BuildingName",
                table: "PurchaseFormModels");

            migrationBuilder.RenameColumn(
                name: "UpdateDate",
                table: "SheepSaleModels",
                newName: "UpdateTime");

            migrationBuilder.RenameColumn(
                name: "Sex",
                table: "SheepSaleModels",
                newName: "SheepSex");

            migrationBuilder.RenameColumn(
                name: "ParentEITag",
                table: "SheepSaleModels",
                newName: "MotherSign");

            migrationBuilder.RenameColumn(
                name: "MotherEITag",
                table: "SheepSaleModels",
                newName: "FatherSign");

            migrationBuilder.RenameColumn(
                name: "CreateDate",
                table: "SheepSaleModels",
                newName: "CreateTime");

            migrationBuilder.RenameColumn(
                name: "ColumnName",
                table: "SheepSaleModels",
                newName: "CurrentField");

            migrationBuilder.RenameColumn(
                name: "BuildingName",
                table: "SheepSaleModels",
                newName: "CurrentBuilding");

            migrationBuilder.RenameColumn(
                name: "ColumnName",
                table: "PurchaseFormModels",
                newName: "ColumnManagementId");

            migrationBuilder.RenameColumn(
                name: "UpdateDate",
                table: "CustomerInformation",
                newName: "UpdateTime");

            migrationBuilder.RenameColumn(
                name: "CreateDate",
                table: "CustomerInformation",
                newName: "CreateTime");

            migrationBuilder.AddColumn<int>(
                name: "ElectronicEarTags",
                table: "SheepSaleModels",
                type: "int",
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "SheepRescissionId",
                table: "PurchaseFormModels",
                type: "int",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.CreateTable(
                name: "PersonalSaleModels",
                columns: table => new
                {
                    PersonalSaleId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    AuditStatus = table.Column<int>(type: "int", nullable: false),
                    AuditTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Auditor = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Client = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    ClosingPrice = table.Column<decimal>(type: "decimal(10,2)", nullable: true),
                    CreateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DeliveryAddress = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    DocumentNumber = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    FinancialAuditTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    FinancialAuditor = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    OnlyNumber = table.Column<int>(type: "int", nullable: false),
                    SaleDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    Salesman = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    Section = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
                    UpdateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    WarehouseAuditTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    WarehouseAuditor = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PersonalSaleModels", x => x.PersonalSaleId);
                });
        }
    }
}
